package com.kaifamiao.wendao.service;

import com.kaifamiao.wendao.dao.ExplainDao;
import com.kaifamiao.wendao.entity.Explain;
import com.kaifamiao.wendao.utils.SnowflakeIdGenerator;

import java.util.List;

public class ExplainService {

    private ExplainDao explainDao = new ExplainDao();

    public boolean save(Explain explain){
        explain.setId(SnowflakeIdGenerator.getInstance().generate());
        explain.setPraise(0);
        explain.setDespise(0);
        return explainDao.save(explain);
    }

    public List<Explain> findAll(Long tid){
        return explainDao.findAll(tid);
    }

    public boolean removeAll(long id){
        return explainDao.removeAll(id);
    }

    public boolean remove(long id){
        return explainDao.remove(id);
    }

    public Explain find(Long id){
        return explainDao.find(id);
    }

    public List<Explain> findByCustomer(Long Cid){
        return explainDao.loadByCustomerID(Cid);
    }
    public boolean update(Explain explain){
        return explainDao.update(explain);
    }
}
